﻿<?php
session_start();

require_once "config.php";
require_once "db.class.php";
require_once "server.class.php";

$params = array("host"=>"$host", "user"=>"$user", "pass"=>"$pass", "db"=>"$db");
$db = new Dbclass($params, false);
$server = new ServerHelperClass($db, $tables);
$userNames = array("小齐", "小平", "小霍", "小揭");
$animalNames = array("团团", "圆圆", "欢欢", "乐乐");
$Scores = array("1","4","12","40");

for ($i = 0; $i < 100; $i++)
{
	$sql = "INSERT INTO ".$tb_heirloom." (currentOwnerPlayerId, originalOwnerPlayerId) VALUES (".$i.",".$i.")";
	$result = $db->query($sql);
	$userName = $userNames[rand(0, 3)].$i;
	$animalName = $animalNames[rand(0, 3)].$i;
	$homeIndex = rand(0, 1);
	$sql = "INSERT INTO ".$tb_user_profile." (renrenId, name, homeIndex) VALUES (-1, '".$userName."', ".$homeIndex.")";
	$result = $db->query($sql);
	$sql = "select last_insert_id()";
	$result = $db->query($sql);
	$arr = $db->fetchArray($result);
	$userId = $arr['last_insert_id()'];
	for ($j = 0; $j < 28; $j++)
	{
		if ($j == 0)
			$num = 999999;
		else
			$num = rand(0, 10);
		$sql = "INSERT INTO ".$tb_user_own_object." (userId, objectIndex, objectNum) VALUES (".$userId.", ".$j.", ".$num.")";
		$result = $db->query($sql);
	}
	for ($j = 29; $j < 96; $j++)
	{
		$num = rand(0, 1);
		if ($num == 1)
		{
			$sql = "INSERT INTO ".$tb_user_own_object." (userId, objectIndex, objectNum) VALUES (".$userId.", ".$j.", ".$num.")";
			$result = $db->query($sql);
		}
	}
	$animalIndex = rand(0, 5);
	$experience = rand(0, 900000);
	$level = rand(1, 1);
	$healthPoint = rand(320, 1000);
	$vitalityPoint = rand(320, 1000);
	$intelligence = rand(20, 80);
	$speed = rand(15, 50);
	$skillPoint = rand(0, 2);
	$animalId = $server->addAnimal($userId, $animalIndex, $animalName, $experience, $level, $healthPoint, $vitalityPoint, $intelligence, $speed, $skillPoint);
	for ($j = 0; $j < rand(1, 4); $j++)
	{
		$value = rand(0, 2);
		$sql = "insert into ".$tb_animal_own_clues." (animalId, clueIndex, clueValue, fakeClueValue) values (".$animalId.", ".$j.", ".$value.", ".$value.")";
		$result = $db->query($sql);
	}
	if ($userId > 5)
	{
	for ($j = 0; $j < 5; $j++)
	{
		$myValue = rand(0,3);
		$sql = "INSERT INTO ".$tb_player_honour." (playerId, equipId, equipLevel) VALUES (".$userId.",".$j.",".$Scores[$myValue].")";
		$result = $db->query($sql);
	}
	}
}
echo "Finished!";

$db->close();

?>
